﻿/**********************************************************************
 * @file   FITKAcousticsSensors.h
 * @brief  FE子系统传感器数据声明
 * @author liuzhonghua (liuzhonghuaszch@163.com)
 * @date   2024-12-17
 *********************************************************************/
#ifndef _FITK_ACOUSTICS_SENSORS_H___
#define _FITK_ACOUSTICS_SENSORS_H___
 
#include "FITKAcousticsModelAPI.h"
#include "FITK_Kernel/FITKCore/FITKAbstractNDataObject.h"
#include "FITK_Kernel/FITKCore/FITKAbstractDataManager.hpp"

namespace Acoustics
{
    class FITKAbstractFESubSys;
    /**
     * @brief  传感器数据类
     * @author liuzhonghua (liuzhonghuaszch@163.com)
     * @date   2024-12-13
     */
    class FITKAcousticsModelAPI FITKAcousticsSensors : public Core::FITKAbstractNDataObject
    {
        FITKCLASS(Acoustics, FITKAcousticsSensors);
        Q_OBJECT
    public:
        /**
         * @brief  传感器连接类型
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date   2024-12-18
         */
        enum SensorConnectionType
        {
            SensorConnectionNode = 1,      ///< 节点
            SensorConnectionElement = 2,   ///< 单元
        };
        Q_ENUM(SensorConnectionType);

        /**
         * @brief  传感器结果类型
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date   2024-12-18
         */
        enum SensorResultType
        {
            SensorResultNone = 0,               ///< 无
            SensorResultVelocityMagnitude,      ///< 速度大小
            SensorResultVelocityDirectional,    ///< 速度方向
            SensorResultPressure,               ///< 压力
        };
        Q_ENUM(SensorResultType);

        /**
         * @brief Construct a new FITKAcousticsSensors object
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date   2024-12-13
         */
        explicit FITKAcousticsSensors();
        /**
         * @brief Destroy the FITKAcousticsSensors object
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date   2024-12-13
         */
        virtual ~FITKAcousticsSensors();
        /**
         * @brief    设置连接对象id-FE子系统
         * @param[i] objID 
         * @return   void
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2024-12-18
         */
        void setFESubSysObjID(int objID);
        /**
         * @brief    获取连接对象id-FE子系统
         * @return   int
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2024-12-18
         */
        int getFESubSysObjID();
        /**
         * @brief    获取连接对象数据-FE子系统
         * @return   FITKAbstractFESubSys *
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2024-12-18
         */
        FITKAbstractFESubSys* getFESubSysObj();
        /**
         * @brief    设置连接数据
         * @param[i] nodeID 节点id
         * @param[i] elemID 单元id
         * @return   void
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2024-12-18
         */
        void setConnection(int nodeID, int elemID);
        /**
         * @brief    获取连接数据
         * @return   QPair<int.int> nodeID, elemID
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2024-12-18
         */
        QPair<int, int> getConnection();
        /**
         * @brief    设置连接类型
         * @param[i] type 
         * @return   void
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2024-12-18
         */
        void setConnectionType(SensorConnectionType type);
        /**
         * @brief    获取连接类型
         * @return   SensorConnectionType
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2024-12-18
         */
        SensorConnectionType getConnectionType();
        /**
         * @brief    设置传感器结果类型
         * @param[i] type 
         * @return   void
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2024-12-18
         */
        void setSensorResultType(SensorResultType type);
        /**
         * @brief    获取传感器结果类型
         * @return   SensorResultType
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2024-12-18
         */
        SensorResultType getSensorResultType();
        /**
         * @brief    设置全局方向
         * @param[i] orientation 
         * @return   void
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2024-12-18
         */
        void setGlobalOrientation(double* orientation);
        /**
         * @brief    获取全局方向
         * @param[o] orientation 
         * @return   void
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2024-12-18
         */
        void getGlobalOrientation(double* orientation);
        /**
         * @brief    获取位置
         * @param[o] location
         * @return   void
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2024-12-18
         */
        void getLocation(double* location);

    protected:
        /**
         * @brief  FE子系统ID
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date   2024-12-18
         */
        int _feSubSysID{ -1 };
        /**
         * @brief  连接数据 NodeID, ElemID
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date   2024-12-18
         */
        QPair<int, int> _connection{ -1, -1 };
        /**
         * @brief  连接类型
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date   2024-12-18
         */
        SensorConnectionType _connectionType{ SensorConnectionType::SensorConnectionNode };
        /**
         * @brief  结果类型
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date   2024-12-18
         */
        SensorResultType _resultType{ SensorResultType::SensorResultPressure };
        /**
         * @brief  全局方向
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date   2024-12-18
         */
        double _globalOrientation[3]{ 0.0, 0.0, 0.0 };
    };
    /**
     * @brief FE传感器管理器
     * @author liuzhonghua (liuzhonghuaszch@163.com)
     * @date   2024-12-13
     */
    class FITKAcousticsModelAPI FITKAcousticsSensorsManager : public Core::FITKAbstractDataObject,
        public Core::FITKAbstractDataManager<FITKAcousticsSensors>
    {
        FITKCLASS(Acoustics, FITKAcousticsSensorsManager);
    public:
        /**
         * @brief Construct a new FITKAcousticsSensorsManager object
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date   2024-12-13
         */
        explicit FITKAcousticsSensorsManager() = default;
        /**
         * @brief Destroy the FITKAcousticsSensorsManager object
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date   2024-12-13
         */
        virtual ~FITKAcousticsSensorsManager() = default;
    };
}


#endif
